package singleton;

/**
 * @author shenhan
 * @create 2020/3/18 22:26
 * @description 双重检查
 */
public class Singleton5 {
    private Singleton5() {

    }

    private static volatile Singleton5 instance;

    public static Singleton5 getInstance() {
        if (instance == null) {
            synchronized (Singleton5.class) {
                if (instance == null) {
                    instance = new Singleton5();
                }
            }
        }
        return instance;
    }
}
